<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <div>
            <!-- 知识点【2】：由于在2.0中只允许过滤器存在于双花括号内，所以双向过滤器不用学，使用计算属性可以实现 -->
            <input type="text" v-model="price | cents">
        </div>
    </div>
    <script type="text/javascript" src="../../../../commonJS/vue.js"></script>
    <script type="text/javascript" src="../../../../commonJS/zepto-1.2.0.js"></script>
    <!-- <script type="text/javascript" src="../../../../commonJS/moment.js"></script> -->
    <!-- <script type="text/javascript" src="../../../../commonJS/common.js"></script> -->
    <script>
        var app = new Vue({
            el: '#app',
            data: {
                price: 150,
                price2: 150
            },
            filters: {
                cents: {
                    read: function(value) {
                        return (value / 100).toFixed(2);
                    },
                    write: function(value) {
                        return value * 100;
                    }
                }
            },
            methods: {

            }
        });
    </script>
</body>